<html>
<head>
<script>

if (window.testRunner)
    testRunner.dumpAsText();

function run() {
    selection = window.getSelection();
    range = document.createRange();
    selection.addRange(range);

    document.designMode = "on";
    document.execCommand("InsertText", false, 'x');
    document.open();
    document.execCommand("Undo");

    selection.deleteFromDocument();

    document.body.innerHTML = 'This calling deleteFromDocument after document.open. WebKit should not crash.<br>PASS';
}
</script>
</head>
<body onload="run()">
</body>
</html>
